# -*- coding:utf-8 -*-
"""
Created on 17 jun 2012

@author: Olof Manbo
"""

lines = open("Furste resurser och antal.txt").readlines()


resourceTypes = []

mode = "START"
submode = ""
counties = []
for n,line in enumerate(lines):
    if mode == "START":
        for m,type in enumerate(line.split('\t')):
            
            if  1 <= m <= 7:
                print m,type
                resourceTypes.append(type)
        mode = "RESOURCES"
    elif mode == "RESOURCES":
        if line.split('\t')[1] == "":
            submode = line.split('\t')[0]
        elif line.split('\t')[1].strip() == "Resurser":
            mode = "BUILDINGS"
            submode = ""
        else:
            county = []
            for m,type in enumerate(line.split('\t')):
                if  0 <= m <= 7:
                    county.append(type)
            county.append(submode)
            print str(county)
            counties.append(county)
print str(counties)

print "areas = {"
for area in counties:
    print '       "%s": %s,'%(area[0].replace("ö","o").replace("Ö","O").replace("ä","a").replace("Ä","A").replace("å","a").replace("Å","A"), unicode(area))
print "       }"
        

